package top.retain;

import java.util.concurrent.CompletableFuture;

/**
 * @author ivorfan
 * @date 2021/7/29 10:22
 */
public class CompleableFutureTest {

    public static void main(String[] args) {
       CompletableFuture.supplyAsync(() -> 1).thenApply(i -> i + 1).thenApply(i -> i*i)
               .whenComplete((v, t) -> System.out.println(v));
        System.out.println("All finished");
    }

}
